﻿using IService.Business;
using IService.DataDLL;
using IService.DataDLL.Utility;
using IService.Utility;
using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace IService
{
    public partial class NewsList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                this.BindData();
            }
        }

        public void BindData()
        {
            PagingEntity pe = new PagingEntity("News", "CreateTime desc");
            pe.PageSize = Pagination.PageSize;
            pe.PageIndex = Pagination.PageIndex;
            pe.WhereClause = "NewsTypeId = 1";
            DataTable table = DTVBusiness.NewsManager.GetNewsListPagin(pe);
            this.rptNewsList.DataSource = table;
            this.rptNewsList.DataBind();
            this.Pagination.BindName = "BindData";
            this.Pagination.Count = pe.RecordCount;
            this.Pagination.BindPager();
        }

        protected string GetShortNewsContent(string content)
        {
            return StringUtil.GetShortContent(content, 80);
        }
    }
}